diff options
| author | Joe Carstairs <jcarstairs@scottlogic.com> | 2023-08-15 17:50:43 +0100 |
|---|---|---|
| committer | Joe Carstairs <jcarstairs@scottlogic.com> | 2023-08-15 17:50:43 +0100 |
| commit | 83144491ded4bb483bf74125794294c58b193b7e (patch) | |
| tree | 69c89b20f28adee7e5631b8b433223fe077f9fb5 /src/pages/[locale] | |
| parent | a28cf885d5cac5d17bae7586ff88ea5e82bd70ff (diff) | |
Pulls out NewsPreviewLink
Diffstat (limited to 'src/pages/[locale]')
| -rw-r--r-- | src/pages/[locale]/news/index.astro | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/pages/[locale]/news/index.astro b/src/pages/[locale]/news/index.astro index 3e1b994..42a17e2 100644 --- a/src/pages/[locale]/news/index.astro +++ b/src/pages/[locale]/news/index.astro @@ -5,7 +5,7 @@ import Page from '$layouts/Page.astro'; import getLocaleFromPath from '$lib/getLocaleFromPath'; import localeStaticPaths from '$lib/localeStaticPaths'; import { getCollection } from 'astro:content'; -import relativePath from '$lib/relativePath'; +import NewsPreviewLink from '$components/NewsPreviewLink.astro'; const allNews = await getCollection('news'); const locale = getLocaleFromPath(Astro.url.pathname); @@ -29,16 +29,7 @@ export async function getStaticPaths() { <div class="news-index"> { allNewsInLocale.length > 0 ? ( - allNewsInLocale.map((item) => ( - <a - class="news-index__item" - href={relativePath(Astro.url.pathname, item.slug.replace('/', '-'))} - > - <h2>{item.data.title}</h2> - <p>{item.data.summary}</p> - <p class="link">{t(tPage, { key: 'read-article' })}</p> - </a> - )) + allNewsInLocale.map((item) => <NewsPreviewLink locale={locale} newsItem={item} />) ) : ( <p>{t(tPage, { key: 'no-news' })}</p> ) |
